home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / tcl / expecTerm / command.h < prev    next >
Encoding:
Text File  |  1993-11-17  |  3.5 KB  |  93 lines  |  [TEXT/MPS ]

  1. /* command.h - definitions for expect commands
  2. ***************************************************************************** 
  3. expecTerm version 1.0 beta
  4. Mark Weissman
  5. Christopher Matheus
  6. Copyright 1992 by GTE Laboratories Incorporated.
  7.  
  8. Portions of this work are in the public domain.  Permission to use,
  9. copy, modify, and distribute this software and its documentation for
  10. any purpose and without fee is hereby granted, provided that the above
  11. copyright notice appear in all copies and that both the copyright
  12. notice and warranty disclaimer appear in supporting documentation, and
  13. that the names of GTE Laboratories or any of their entities not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.
  16.  
  17. GTE disclaims all warranties with regard to this software, including
  18. all implied warranties of merchantability and fitness for a particular
  19. purpose, even if GTE Laboratories Incorporated knows about the
  20. purpose.  In no event shall GTE be liable for any special, indirect or
  21. consequential damages or any damages whatsoever resulting from loss of
  22. use, data or profits, whether in an action of contract, negligence or
  23. other tortuous action, arising out of or in connection with the use or
  24. performance of this software.
  25.  
  26. This code is based on and may include parts of Don Libes' expect code:
  27.   expect written by: Don Libes, NIST, 2/6/90
  28.   Design and implementation of expect was paid for by U.S. tax
  29.   dollars.  Therefore it is public domain.  However, the author and NIST
  30.   would appreciate credit if this program or parts of it are used.
  31. ******************************************************************************
  32.  
  33.  
  34. Written by: Don Libes, NIST, 2/6/90
  35. Modified by: Mark Weissman 9/92
  36.  
  37. Design and implementation of this program was paid for by U.S. tax
  38. dollars.  Therefore it is public domain.  However, the author and NIST
  39. would appreciate credit if this program or parts of it are used.
  40. */
  41.  
  42. void tcl_error();
  43. int getmaster();
  44. char *get_var();
  45. double get_timeout();    /* MDW: Mon Jun 22 13:25:47 1992 */
  46. extern int master;
  47. struct f *update_master();
  48. extern int default_match_max;
  49.  
  50. extern int loguser;    /* shared by cmdLoguser, cmdExpect and cmdSpawn */
  51.  
  52. /* special version of log for non-null-terminated strings which */
  53. /* never need printf-style formatting. */
  54. #define logn(buf,length)  { \
  55.               if (logfile) fwrite(buf,1,length,logfile); \
  56.               if (debugfile) fwrite(buf,1,length,debugfile); \
  57.               }
  58.  
  59. #define USER_SPAWN_ID        0
  60. #define USER_SPAWN_ID_LIT    "0"
  61. #define is_user(x)    (x == 0)
  62.  
  63. /* fd flags */
  64. #define FD_VALID    0x1    /* valid entry in fds table */
  65. #define FD_CLOSED    0x2    /* has been closed */
  66. #define FD_USER        0x4    /* stdin or stdout */
  67. #define FD_SYSWAITED    0x8    /* wait() has been called */
  68. #define FD_USERWAITED    0x10    /* expect's wait has been called */
  69.  
  70. /* each process is associated with a 'struct f'.  An array of these ('fs') */
  71. /* keeps track of all processes.  They are indexed by the true fd to the */
  72. /* master side of the pty */
  73. struct f {
  74.     int pid;
  75.     char *buffer;    /* input buffer */
  76.     char *lower;    /* input buffer in lowercase */
  77.     int size;    /* current size of data */
  78.     int msize;    /* size of buffer */
  79.     int umsize;    /* user view of size of buffer */
  80.     int flags;    /* see above */
  81.     int wait;    /* raw status from wait() */
  82.     int printed;    /* # of characters written to stdout (if logging on) */
  83.             /* but not actually returned via a match yet */
  84.     double quiet_total_start;
  85.     double quiet_after_noise_start;
  86.     double quiet_start;
  87.     double quiet_end;
  88. };
  89. extern struct f *fs;
  90.  
  91. struct f *fd_to_f();
  92. int f_adjust();
  93.